﻿

@{
    Layout = "";
}
<style>
    .ngdialog.ngdialog-theme-plain .ngdialog-content {
        width: 25% !important;
    }
</style>
<div ng-controller="LevelListController">
    <h3>会员等级</h3>

    <div class="panel panel-default" ng-class="{ 'whirl standard': isLoading}">
        <div class="panel-heading">
            <div class="form-inline ng-pristine ng-valid">
                @*<div class="form-group">
        <input id="input-email" placeholder="会员昵称" class="form-control" type="text" ng-model="Keywords">
        <button type="submit" class="btn btn-labeled btn-primary" ng-click="tableParams.$params.page = 1;tableParams.reload()">
            <span class="btn-label">
                <em class="fa fa-search"></em>
            </span>搜索
        </button>
    </div>
    <div class="form-group">
            <button type="submit" class="btn btn-labeled btn-success" ng-click="positionManagementUpdataView(0)">
                <span class="btn-label">
                    <em class="fa fa-plus"></em>
                </span>新增
            </button>
        </div>*@
            </div>
        </div>
        <div class="panel-body">
            <div class="table-responsive">
                <table ng-table="tableParams" class="table table-striped table-bproducted table-hover">
                    <tbody>
                        <tr ng-repeat="item in $data">
                            <td data-title="'等级名称'" class="text-center">{{item.LevelName}}</td>
                            <td data-title="'消费额度'" class="text-center">{{item.Amount}}</td>
                            <td data-title="'折扣率'" class="text-center">{{item.Discount}}%</td>
                            <td data-title="'会员日（积分倍）'" class="text-center">{{item.MemberDayTimes}}</td>
                            <td data-title="'每日签送（积分）'" class="text-center">{{item.SignPoint}}</td>
                            <td data-title="'订单总额积分比例'" class="text-center">{{item.OrderPoint}}%</td>
                            <td data-title="'说明'" class="text-center">{{item.Explain}}</td>
                            <td data-title="'操作'" nowrap="nowrap" class="text-center">

                                <button type="button" ng-click="memberDetail(item.Id)" class="btn btn-sm btn-edit" title="编辑">
                                    <em class="fa fa-edit"></em>
                                </button>

                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<script type="text/ng-template" id="deleteConfirmDialog">
    <div class="ngdialog-message  text-center">
        <h3>确定要删除吗?</h3>
        <p>删除后该分组下所有员工权限将不可用且不可恢复!</p>
        <button type="button" ng-click="confirm()" class="btn btn-primary mr">确认</button>
        <button type="button" ng-click="closeThisDialog('button')" class="btn btn-default">取消</button>
    </div>
</script>
<script>
    App.controller('LevelListController', [
    '$scope', '$resource', '$state', '$route', '$http', 'ngTableParams', 'ngTableDataService', 'Notify', '$filter', 'ngDialog', "$stateParams", "$timeout", "toaster",
        function ($scope, $resource, $state, $route, $http, ngTableParams, ngTableDataService, Notify, $filter, ngDialog, $stateParams, $timeout, toaster) {
            'use strict';
            $scope.isLoading = true;
            //数据查询
            $scope.tableParams = new ngTableParams({
                page: 1,
                count: 10,
                sorting: {
                    Id: ''     // 初始化排序
                }
            }, {
                getData: function ($defer, params) {
                    $scope.isLoading = true;
                    var requestParams = {
                        Skip: (params.page() - 1) * params.count(),
                        Take: params.count(),
                        Keywords: $scope.Keywords
                    };
                    $http.post('/Member/GetLevelList', ngTableDataService.getServerSideParams(params.orderBy().toString(), params, requestParams))
                        .success(function (data, status) {
                            params.total(data.Total);
                            $defer.resolve(data.Results);
                            $scope.isLoading = false;
                        });
                }
            });

            //跳转更新页面
            $scope.memberDetail = function (id) {
                $state.go('app.leveldetail', { "id": id });
            }

            $scope.getChecked = function () {
                alert($("#authTree").jstree().get_checked());
            }
        }
    ]);
</script>
